urbitfandomcom-20200213-history
Runes
Hoon has roughly 90 diglyphs called runes. Most of them are undocumented. This page gives our current knowledge of their meaning. Most of our current knowledge comes from reading the Urbit documentation and the Hoon source. Single letter runes $ buc bc Seems to mean recursion in functions. @ pat pt Appears in argument descriptions, and other places. + lus ls Increment ! zap zp Negation & pam pm And? Also evaluates to true (%.y). | bar br Or? Also evaluates to false (%.n). ? wut wt Unknown. Appears frequently after ^- ~ sig sg Seems to be an alias for 0. Possibly analogous to unit. $ (buc) Factory macros (i.e., type definitions) $| bucbar bcbr: Takes two hoons, and produces a hoon $_ buccab bccb: Takes one hoon, and produces a hoon $: buccol bccl: Takes one gens, and produces a hoon $% buccen bccn: Takes one hoon and one gens, and produces a hoon $, buccom bccm: Takes one hoon, and produces a hoon $^ bucket bckt: Takes one hoon, and produces a hoon $& bucpam bcpm; Takes two hoons, and produces a hoon $* buctar bctr: Takes one hoon, and produces a hoon $= buctis bcts: Takes one bozo, and produces a hoon $? bucwut bcwt: Takes one hoon and one gens, and produces a hoon | (bar) Gates (i.e., functions) (i.e., one method cores) || barbar brb: Takes two hoons, and produces a hoon |_ barcab brcb: Takes one hoon and one (map term foot), and produces a hoon |: barcol bcl: Takes one hoon and one (map term foot), and produces a hoon. Chapter 6: :barcol does inheritance. This isn’t used in Hoon or Arvo now, so don’t use it or expect it to work. |% barcen brcn: Takes one (map term foot), and produces a hoon. Chapter 6: :barcen is the way we create cores. For any subject type sut, barcen produces the core type sut %gold ~ p.gen. If the subject noun is ctx, the product is ctx, where bat is the battery generated by p.gen. |. bardot brdt: Takes one hoon, and produces a hoon |^ barket brkt: Takes one hoon and one (map term foot), and produces a hoon |- barhep brhp: Takes one hoon, and produces a hoon. Seems to be used for looping. |+ barlus brls: Takes two hoons, and produces a hoon |* bartar brtr: Takes two hoons, and produces a hoon |= bartis brts: Takes two hoons, and produces a hoon. Seems to be used to specify argument types to a function. The first hoon usually has the form of an argument list, like a=@ or b=@ :~sartyn-picwep/try=> (|=(a=@ (add a 3)) 4) :7 :~sartyn-picwep/try=> (|=(b=@ (add a b)) 10 20) :30 |? barwut brwt: Takes one hoon, and produces a hoon : (col) Tuples :: colcol clcl: Comment marker :_ colcab clcb: Takes two hoons, and produces a hoon :% colcen clcn: Takes one gens, and produces a hoon :/ colfas clfs: Takes one hoon, and produces a hoon :^ colket clkt: Takes four hoons, and produces a hoon :- colhep clhp: Takes two hoons, and produces a hoon :+ collus clls: Takes three hoons, and produces a hoon :~ colsig clsg: Takes one gens, and produces a hoon :* coltar cltr: Takes one gens, and produces a hoon :! colzap clzp: Takes one gens, and produces a hoon % (cen) Invocations %$ cenbuc cnbc: Takes one term, and produces a hoon %_ cencab cncb: Takes one wing and one gent, and produces a hoon %: cencol cncl: Takes two hoons, and produces a hoon %. cendot cndt Takes two hoons, and produces a hoon %- cenhep cnhp Takes one hoon and one gens, and produces a hoon %# cenhax cnhx Takes one wing, and produces a hoon %* centar cntr Takes one wing, one hoon, and one gent, and produces a hoon %^ cenket cnkt Takes four hoons, and produces a hoon %+ cenlus cnls Takes three hoons, and produces a hoon %~ censig cnsg Takes one wing and two hoons, and produces a hoon %= centis cntis Takes one wing and one gent, and produces a hoon. Described in more detail in Chapter 6. ? (wut) Conditionals, booleans, tests ?- wuthep wthp Takes one hoon and one gent, and produces a hoon. Seems to be doing matching ?| wutbar wtbr Takes one gens, and produces a hoon ?: wutcol wtcl Takes three hoons, and produces a hoon. Hoon equivalent of if-then-else: if the first hoon evaluates to true, evaluate the second hoon, otherwise evaluate the third hoon. :~sartyn-picwep/try=> ?:(=(0 0) "foo" "bar") :"foo" :~sartyn-picwep/try=> ?:(=(0 1) "foo" "bar") :"bar" ?% wutcen wtcn Takes two hoons, and produces a hoon. Chapter 6: :wutcen, normally used only through the macro ?=, is true if and only if the dynamic product of q is in the range of p. ?. wutdot wtdt Takes three hoons, and produces a hoon ?^ wutket wtkt Takes three hoons, and produces a hoon ?< wutgal wtgl Takes two hoons, and produces a hoon. Seems to indicate that the function should exit with an error if a condition returns true. ?> wutgar wtgr Takes two hoons, and produces a hoon ?+ wutlus wtls Takes two hoons and one gent, and produces a hoon ?& wutpam wtpm Takes one gens, and produces a hoon ?@ wutpat wtpt Takes three hoons, and produces a hoon ?~ wutsig wtsg Takes three hoons, and produces a hoon ?= wuttis wtts Takes two hoons, and produces a hoon ?! wutzap wtzp Takes one hoon, and produces a hoon . (dot) Nock operators .^ dotket dtkt Takes one hoon, and produces a hoon. Chapter 6: :dotket dereferences the global namespace, generating Nock operator 11. “But there is no Nock operator 11,” you protest. That’s right - but your Arvo code runs not in Nock, but in a superset of it, ++mock, in which there is an operator 11. Its operand is an untyped noun and so is its product. .+ dotlus dtls Takes one hoon, and produces a hoon. Nock increment. :~sartyn-picwep/try=> .+(3) :4 .@ dotpat dtpt Takes one term and one "@", and produces a hoon. Chapter 6: :Constant atom. p is the odor. Just generated by the parser - you won’t see any .@ runes in your Hoon file. The type is p.gen. .~ dotsig dtsg Takes one term and one "*", and produces a hoon. Chapter 6: :Constant atom or cell. You might think this is redundant with %dtpt, but the type it produces is a %cube, typed as a constant - eg, if q is an atom, [%atom p.gen q.gen]. Still, there is something confusing and ugly here. .* dottar dttr Takes two hoons, and produces a hoon. Chapter 6: :Nock 2. If you want to run Nock from Hoon without another layer of virtualization, this is what you use. Needless to say, the product is an untyped noun. .= dottis dtts Takes two hoons, and produces a hoon. Chapter 6: :Nock 5, ie, equals. 0 is yes, 1 is no. .? dotwut dtwt Takes one hoon, and produces a hoon. Chapter 6: :Nock 3 - 0 (yes, &) for cell, 1 (false, |) for atom. Examples: :~sartyn-picwep/try=> .?(3) :%.n :~sartyn-picwep/try=> .?(2) :%.y # (hax) ??? #< haxgal hxgl Takes one gens, and produces a hoon #> haxgar hxgr Takes one gens, and produces a hoon ^ (ket) Type conversions ^| ketbar ktbr Takes one hoon, and produces a hoon. Chapter 6: :ketbar converts a gold core to %iron, ie, contravariant. ^+ ketlus ktls Takes two hoons, and produces a hoon. Chapter 6: :ketlus casts q.gen to p.gen, so long as q.gen is geometrically compatible with p.gen (ie, any product of q.gen with the present subject can be used as if it was the product of p.gen with the present subject). ^. ketdot ktdt Takes two hoons, and produces a hoon. Chapter 6: :ketdot - snap. This takes the superficial namespace of p and applies it to q. You will never use this; it appears only in the bowels of macros; and if we had to explain why it exists at all, we’d be embarrassed. So we won’t. ^- kethep kthp Takes two hoons, and produces a hoon. Appears frequently in lines of the form :^- @ and :^- ? Seems to be used to specify the return type of a function: @ means atom (i.e. unsigned integer), ? means boolean. ^& ketpam ktpm Takes one hoon, and produces a hoon. Chapter 6: :ketpam converts a gold core to %zinc, ie, covariant. ^~ ketsig ktsg Takes one hoon, and produces a hoon. Chapter 6: :ketsig tries to execute p.gen statically at compile time. If it fails, it just leaves the dynamic expression. ^= kettis ktts Takes one term and one hoon, and produces a hoon. Chapter 6: :kettis wraps a %face around q.gen, ie, names it. Examples: :~sartyn-picwep/try=> ^=(foo 3) :foo=3 :~sartyn-picwep/try=> foo=3 :foo=3 ^? ketwut ktwt Takes one hoon, and produces a hoon. Chapter 6: :ketwut converts any core to %lead, ie, bivariant. (tis) Compositions =| tisbar tsbr Takes two hoons, and produces a hoon =: tiscol tscl Takes one gent and one hoon, and produces a hoon =. tisdot tsdt Takes three hoons, and produces a hoon =< tisgal tsgl Takes two hoons, and produces a hoon => tisgar tsgr Takes two hoons, and produces a hoon. Chapter 6: :tisgar uses the product of p as the subject of q. The code from ++play should say it all: $(gen q.gen, sut $(gen p.gen)) :=>(p q) seems to produce q in a large number of cases. :~sartyn-picwep/try=> =>(3 4) :4 :~sartyn-picwep/try=> =>(3 4) :4 :~sartyn-picwep/try=> =>(3 |=(a=@ a)) :<1.cue @ud> :~sartyn-picwep/try=> (=>(3 |=(a=@ a)) 10) :10 The first hoon is often .(something), and sometimes ^+(something) =^ tisket tskt Takes four hoons, and produces a hoon =+ tislus tsls Takes two hoons, and produces a hoon. Seems to be used to introduce new variables. Possibly a let binding. :~sartyn-picwep/try=> =+(a=37 (add a 3)) :40 =- tishep tshp Takes two hoons, and produces a hoon =~ tissig tssg Takes one gens, and produces a hoon & (pam) Gears (i.e., objects) (i.e., multi-method cores) ~ (sig) Hints ~| sigbar sgbr Takes two hoons, and produces a hoon. It seems to indicate errors somehow, often its first argument is %foo, where foo is a plausible error, like %unsupported or %subtract-underflow. Also shows up fairly frequently in the pattern "~|(%foo !!)" ~: sigcol sgcl Takes one q=@ and one hoon, and produces a hoon ~% sigcen sgcn Takes one chop, one hoon, one genu, and another hoon, and produces a hoon ~/ sigfas sgfs Takes one chop and one hoon, and produces a hoon. Often appears as the first line in standard library functions, with the form: : ++fun :: ~/ %fun :: (code) It seems likely that it indicates the existence of an optimized version of the function in this directory. ~< siggal sggl Takes one $|(term q=hoon) and one hoon, and produces a hoon ~> siggar sggr Takes one $|(term q=hoon) and one hoon, and produces a hoon. Chapter 6: :siggar is a hint - any hint (Nock 10). There are many hints, all semantically transparent. ~$ sigbuc sgbc Takes one term and one hoon, and produces a hoon ~# sighax sghx Takes one term and one hoon, and produces a hoon ~^ sigket sgkt Takes two hoons, and produces a hoon ~+ siglus sgls Takes one "@" and one hoon, and produces a hoon ~& sigpam sgpm Takes one @ud and two hoons, and produces a hoon ~= sigtis sgts Takes two hoons, and produces a hoon ~? sigwut sgwt Takes one @ud and three hoons, and produces a hoon ~! sigzap sgzp Takes two hoons, and produces a hoon ; (sem) Miscellaneous macros ;_ semcab smcb Takes two hoons, and produces a hoon ;: semcol smcl Takes one hoon and one gens, and produces a hoon ;, semcom smcm Takes one hoon and one gens, and produces a hoon ;% semcen smcn Takes one gens, and produces a hoon ;. semdot smdt Takes one hoon and one gens, and produces a hoon ;" semdoq smdq Takes one (list beer), and produces a hoon ;< semgal smgl Takes three hoons, and produces a hoon ;> semgar smgr Takes three hoons, and produces a hoon ;^ semket smkt Takes two hoons, and produces a hoon ;- semhep smhp Takes two hoons, and produces a hoon ;# semhax smhx Takes one (list beer), and produces a hoon ;+ semlus smls Takes two hoons, and produces a hoon ;& sempam smpm Takes one hoon and one gens, and produces a hoon ;~ semsig smsg Takes one hoon and one gens, and produces a hoon ;; semsem smsm Takes two hoons, and produces a hoon ;* semtar smtr Takes two hoons, and produces a hoon ;= semtis smts Takes two hoons, and produces a hoon ;? semwut smwt Takes two hoons, and produces a hoon ! (zap) Special operations !_ zapcab zpcb Takes one spot and one hoon, and produces a hoon. Chapter 6: :zapcab is only generated by the parser, within a !: hoon, to produce debugging traces. !, zapcom zpcm Takes two hoons, and produces a hoon. Chapter 6: :zapcom produces the literal hoon q as a constant, casting it to the type of p - which had better be ++hoon. This should be enforced, but isn’t right now. !% zapcen zpcn Takes one "~", and produces a hoon. Chapter 6: :zapcen is obsolete but used to help with booting. !/ zapfas zpfs Takes one hoon, and produces a hoon. Chapter 6: :zapfas, only generated by the parser, indicates a path that should never be taken. !> zapgar zpgr Takes one hoon, and produces a hoon. Seems to be a print statement, as the following line occurs in /=main=/bin/hello/hoon: :!>("hello, {(trip planet)}.") !; zapsem zpsm Takes two hoons, and produces a hoon. Chapter 6: :zapsem produces a value pair, sometimes known as a vase. p should be ++type. This should be checked, but isn’t. != zaptis zpts Takes one hoon, and produces a hoon. Seems to also mean "not equal to". Chapter 6: :zaptis produces the Nock formula generated by p as an untyped noun. !! zapzap zpzp Takes one "~", and produces a hoon. Chapter 6: :zapzap always exits, and of course produces void. Miscellaneous ++ luslus lsls: Seems to name functions